/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mysweethome.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author BKC
 */
@Entity
@Table(name = "Directory", catalog = "MySweetHomeDB", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Directory.findAll", query = "SELECT d FROM Directory d"),
    @NamedQuery(name = "Directory.findByDirectoryID", query = "SELECT d FROM Directory d WHERE d.directoryID = :directoryID"),
    @NamedQuery(name = "Directory.findByDirectoryName", query = "SELECT d FROM Directory d WHERE d.directoryName = :directoryName"),
    @NamedQuery(name = "Directory.findByDescription", query = "SELECT d FROM Directory d WHERE d.description = :description")})
public class Directory implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "DirectoryID")
    private Integer directoryID;
    @Basic(optional = false)
    @Column(name = "DirectoryName")
    private String directoryName;
    @Column(name = "Description")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "directory")
    private List<DirectoryInfo> directoryInfoList;

    public Directory() {
    }

    public Directory(Integer directoryID) {
        this.directoryID = directoryID;
    }

    public Directory(Integer directoryID, String directoryName) {
        this.directoryID = directoryID;
        this.directoryName = directoryName;
    }

    public Integer getDirectoryID() {
        return directoryID;
    }

    public void setDirectoryID(Integer directoryID) {
        this.directoryID = directoryID;
    }

    public String getDirectoryName() {
        return directoryName;
    }

    public void setDirectoryName(String directoryName) {
        this.directoryName = directoryName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<DirectoryInfo> getDirectoryInfoList() {
        return directoryInfoList;
    }

    public void setDirectoryInfoList(List<DirectoryInfo> directoryInfoList) {
        this.directoryInfoList = directoryInfoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (directoryID != null ? directoryID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Directory)) {
            return false;
        }
        Directory other = (Directory) object;
        if ((this.directoryID == null && other.directoryID != null) || (this.directoryID != null && !this.directoryID.equals(other.directoryID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mysweethome.entities.Directory[directoryID=" + directoryID + "]";
    }

}
